package com.example.taximeter.controller;


import com.example.taximeter.bean.ReturnInfo;
import com.example.taximeter.bean.Search;
import com.example.taximeter.bean.UpdateRecord;
import com.example.taximeter.service.UpdateRecordService;
import com.example.taximeter.service.UserService;
import org.springframework.web.bind.annotation.*;

/**
 * 版本升级记录管理
 */
@RestController
@RequestMapping(value = "/record", method = RequestMethod.POST)
public class UpdateRecordController {

    private UpdateRecordService updateRecordService;
    private UserService userService;

    public UpdateRecordController(UpdateRecordService updateRecordService,UserService userService){
        this.updateRecordService = updateRecordService;
        this.userService = userService;
    }

    //查看版本升级记录列表
    @RequestMapping(value = "/all")
    public ReturnInfo findSearchAll(@RequestParam(value = "pageNum", defaultValue = "0") String pageNum,
                                    @RequestParam(value = "pageSize", defaultValue = "0") String pageSize,
                                    @RequestBody UpdateRecord updateRecord) {
        //添加日志
        userService.addUserLog(7,updateRecord.toString());
        return updateRecordService.findSearchAll(Integer.valueOf(pageNum), Integer.valueOf(pageSize), updateRecord);
    }

}
